package com.group.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.group.pojo.Delivery;
import com.group.pojo.JobData;
import com.group.mapper.JobDataMapper;
import com.group.service.JobDataService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author group
 * @since 2021-09-06
 */
@Service
public class JobDataServiceImpl implements JobDataService {
    @Autowired
    JobDataMapper jobDataMapper;

    @Override
    public PageInfo<JobData> getJobData1(JobData jobData, Integer pageNo, Integer pageSize) {
        pageNo = pageNo == null ? 1 : pageNo;
        pageSize = pageSize == null ? 5 : pageSize;
        PageHelper.startPage(pageNo, pageSize);
        List<JobData> list = jobDataMapper.getJobDataByJobId1(jobData);
        PageInfo<JobData> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public boolean updateJobDataState1(JobData jobData) {
        return jobDataMapper.updateJobDataState1(jobData) > 0 ? true : false;
    }

    @Override
    public PageInfo<JobData> getJobDataByUserId1(JobData jobData, Integer pageNo, Integer pageSize) {
        pageNo = pageNo == null ? 1 : pageNo;
        pageSize = pageSize == null ? 10 : pageSize;
        PageHelper.startPage(pageNo, pageSize);
        List<JobData> list = jobDataMapper.getJobDataByUserId1(jobData);
        PageInfo<JobData> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public boolean addJobData1(JobData jobData) {
        jobData.setDeletedstate(0);
        jobData.setDatastate(0);
        return jobDataMapper.addJobData1(jobData) > 0;
    }

    @Override
    public boolean deleteJobData1(Integer id) {
        return jobDataMapper.deleteJobDataById1(id) > 0;
    }

    @Override
    public boolean deleteJobDataBatch1(String[] list) {
        return jobDataMapper.deleteJobDataBatch1(list) > 0;
    }


}
